package solutions.leetcode.easy;

import solutions.lib.BaseSolution;

import java.util.LinkedList;
import java.util.List;

/**
 * @author lizhidong
 * <a href="https://leetcode-cn.com/problems/fizz-buzz/">412. Fizz Buzz</a>
 */
public class Solution412 extends BaseSolution {

    public List<String> fizzBuzz(int n) {
        List<String> rst = new LinkedList<>();
        for (int i = 1; i <= n; i++) {
            if (n % 3 == 0 && n % 5 == 0) {
                rst.add("FizzBuzz");
            } else if (n % 3 == 0) {
                rst.add("Fizz");
            } else if (n % 5 == 0) {
                rst.add("Buzz");
            } else {
                rst.add(String.valueOf(i));
            }
        }
        return rst;
    }

    public static void main(String[] args) {
        Solution412 solution = new Solution412();
    }
}